package baiqitun.stupro.security.entity;

import baiqitun.stupro.common.constant.SysConstant;
import baiqitun.stupro.common.entity.Entity;
import baiqitun.stupro.common.entity.TreeNode;
import baiqitun.stupro.common.validate.group.SaveGroup;
import baiqitun.stupro.common.validate.group.SaveRootGroup;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Null;

/**
 * <p>
 * 许可表
 * </p>
 *
 * @author kedaji
 * @since 2020-03-25
 */
@ApiModel("许可")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("stupro_permission")
public class SysPermission extends TreeNode {

    private static final long serialVersionUID=1L;
    @NotBlank(message = "父许可id不能为空", groups = {SaveGroup.class})
    @Null(message = SysConstant.ER_PARAMETER_MUST_NULL, groups = {SaveRootGroup.class})
    @ApiModelProperty("父许可id")
    private String parentId;

    @ApiModelProperty(value = "角色id")
    private String roleId;

    @NotBlank(message = "许可名称不能为空", groups = {SaveRootGroup.class, SaveGroup.class})
    @ApiModelProperty("许可名称")
    private String name;

    @ApiModelProperty(value = "组件")
    private String component;

    @ApiModelProperty(value = "是否显示状态(0不显示 1显示)")
    private String hidden;

    @ApiModelProperty("许可分组")
    @TableField("`group`")
    private String group;

    @ApiModelProperty(value = "请求路径")
    private String uri;

    @ApiModelProperty("请求方式")
    private String method;

    @ApiModelProperty("图标")
    private String icon;

    @NotBlank(message = "isUi不能为空",groups = {SaveRootGroup.class, SaveGroup.class})
    @ApiModelProperty("是否是UI，1:是 0:不是")
    private String isUi;

    @Null(message = SysConstant.ER_PARAMETER_MUST_NULL, groups = {SaveRootGroup.class, SaveGroup.class})
    @ApiModelProperty("是否叶子节点， 1:是   0:不是")
    private String isLeaf;

    @Null(message = SysConstant.ER_PARAMETER_MUST_NULL, groups = {SaveRootGroup.class, SaveGroup.class})
    @ApiModelProperty("是否可用，1:可用   0:禁用")
    private String enabled;

    @ApiModelProperty("许可描述")
    private String description;

    @ApiModelProperty("菜单显示序号")
    private Integer sortNo;

}
